package com.tnmi.exception;

import com.tnmi.exception.code.ExceptionCode;

/**
 * @version 1.0
 * @Classname BizException
 * @Description TODO
 * @Date 2023/7/4 20:03
 * @Created by tnmi
 **/
public class BizException extends RuntimeException{
    protected final String message;

    protected final Integer code;

    public BizException(String message,Integer code){
        this.message = message;
        this.code = code;
    }

    public BizException(ExceptionCode ex){
        this.code = ex.getCode();
        this.message =ex.getMsg();
    }
    public BizException(String message,Integer code,Throwable e){
        super(message,e);
        this.message = message;
        this.code =code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public Integer getCode() {
        return code;
    }
}
